Chronic pain is common among individuals treated with opioid agonist therapies (OAT; buprenorphine or methadone) and is associated with poorer opioid use disorder (OUD) outcomes, including higher attrition and higher levels of drug use. Treatment of chronic pain in individuals who are maintained on OAT is complex, as presence of chronic pain is associated with greater frequency of psychiatric disorders as well as sleep problems and other comorbidities that can contribute to poorer outcomes. Given the large number of individuals with chronic pain seeking OAT, standardized, lower-cost, and easily disseminable approaches to treat individuals in OAT who have chronic pain are needed and, if demonstrated to be effective in this population, would have high public health significance. In response to RFA-AT-19-006, we plan to develop and pilot test an integrated, web-based cognitive behavioral approach (R61 phase), and then conduct a randomized clinical trial evaluating its efficacy relative to standard care in a large and diverse sample of individuals with chronic pain treated with buprenorphine or methadone (R33 phase). The new program will retain key components of Dr. Carroll?s computer-based training for cognitive-behavioral therapy (CBT4CBT), including its emphasis on teaching cognitive and behavioral coping skills in an engaging way and focus on the 5 A?s of MAT (Adherence, Attendance, Abstinence, Alternate Activities and Accessing support); it will add components from Dr. Heapy?s COPES (Cooperative Pain Education and Self-Management) intervention (self-management of chronic pain, with IVR monitoring of pain intensity and interference, physical activity, and skills practice) and modify existing CBT4CBT modules to address the complex interplay between pain and drug use in this population, emphasizing the development of generalizable skills. In the R33 phase, we will conduct a randomized clinical trial evaluating CBT4CBT-COPES in a diverse sample 160 of individuals enrolled in agonist treatment (methadone or buprenorphine) who have chronic pain, in a 3-month randomized clinical trial with a 6-month follow-up, comparing it to standard treatment alone. The primary retention outcome will be adherence with agonist treatment; the primary pain outcome will be the PROMIS 6-item Pain Interference Short Form.